<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('micros', function (Blueprint $table) {
            $table->id();
            $table->string('number')->unique()->comment('小鹅通微页面ID');
            $table->string('title')->comment('微页面标题');
            $table->text('description')->nullable()->comment('微页面描述');
            $table->string('cover')->nullable()->comment('封面图片URL');
            $table->longText('content')->nullable()->comment('微页面JSON结构内容');
            $table->string('page_type')->default('normal')->comment('页面类型: normal, product, live, etc.');
            $table->json('config')->nullable()->comment('页面配置，如背景、颜色等');
            $table->tinyInteger('status')->default(1)->comment('状态: 0-草稿, 1-已发布, 2-已下架');
            $table->timestamp('published_at')->nullable()->comment('发布时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('micros');
    }
};
